// 系统信息模块
const state = {
	systemInfo: null, // 存储系统信息
};

const mutations = {
	// 设置系统信息
	SET_SYSTEM_INFO(state, systemInfo) {
		state.systemInfo = systemInfo;
	},
};

const actions = {
	// 获取系统信息
	getSystemInfo({
		commit
	}) {
		return new Promise((resolve) => {
			uni.getSystemInfo({
				success: (res) => {
					res.menuBtnInfo = uni.getMenuButtonBoundingClientRect()
					commit("SET_SYSTEM_INFO", res);
					resolve(res);
				},
			});
		});
	},
};

const getters = {
	systemInfo: (state) => state.systemInfo,
};

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters,
};